package Controller;

import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;

import Model.Order;
import Model.RUWSpinner;

public class RUWChangeListener implements ChangeListener {

	@Override
	public void stateChanged(ChangeEvent e) {
		RUWSpinner spinner = (RUWSpinner)e.getSource();
		Order order = spinner.getCustomer().getOrder();
		order.addLine(spinner.getItem(), (int)spinner.getValue());
//		TreeMap<MenuItem, Integer> orderedItems = (TreeMap<MenuItem, Integer>)order.getLineItems();
//		Iterator it = orderedItems.entrySet().iterator();
//		while(it.hasNext()) {
//			Map.Entry pairs = (Map.Entry)it.next();
//			System.out.println(pairs.getKey() + " " + pairs.getValue());
//		}
//		System.out.println("\n\n");
	}
}
